package com.hnevc.yinqi;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.hnevc.yinqi.adapter.MyAdapter;

public class TwoActivity extends AppCompatActivity {

    private ListView listView;
    private String[] shunxus;
    private int[] imgs;
    private String[] guojias;
    private String[] qingkuangs;
    private String[] jinqiuqingkuangs;
    private String[] jifens;
    private String[] xiangxi;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.twoactivity_layout);
        initView();
        initData();
        initEvent();
    }
    protected void initView(){
        listView = findViewById(R.id.listview);

    }
    protected void initData(){
        shunxus = new String[]{"A1","A2","A3","A4"};
        imgs = new int[]{R.drawable.elos,R.drawable.wulagui,R.drawable.aiji,R.drawable.shatealabo};
        guojias = new String[]{"俄罗斯","乌拉圭","埃及","沙特阿拉伯"};
        qingkuangs = new String[]{"胜：2 负：0 平：0","胜：2 负：0 平：0","胜： 负：2 平：0","胜：0 负：2 平：0"};
        jinqiuqingkuangs = new String[]{"进球：8 失球：1","进球：2 失球：0","进球：1 失球：4","进球：0 失球：6"};
        jifens = new String[]{"6分","6分","0分","0分"};
        xiangxi = new String[]{"俄罗斯5-0沙特，俄罗斯3-1埃及","俄罗斯5-0沙特，俄罗斯3-1埃及","俄罗斯5-0沙特，俄罗斯3-1埃及","俄罗斯5-0沙特，俄罗斯3-1埃及"};
        listView.setAdapter(new MyAdapter(TwoActivity.this, shunxus, imgs, guojias));

    }
    protected void initEvent(){
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(TwoActivity.this,ThreeActivity.class);
                intent.putExtra("shunxu",shunxus[position]);
                intent.putExtra("guojia",guojias[position]);
                intent.putExtra("qingkuang",qingkuangs[position]);
                intent.putExtra("jinqiuqingkuang",jinqiuqingkuangs[position]);
                intent.putExtra("xiangxi",xiangxi[position]);
                startActivity(intent);
            }
        });

    }
}
